package com.ojoin.trade.common.utils.json;

import java.io.IOException;

import org.apache.commons.lang3.math.NumberUtils;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.ojoin.trade.common.utils.MoneyUtil;
/**
 * 人民币格式输出
 * @author huanggc
 *
 */
public  class RMBDisplaySerializer extends JsonSerializer<String>{  
        @Override  
        public void serialize(String money, JsonGenerator gen, SerializerProvider provider)  
                throws IOException, JsonProcessingException { 
        	if(NumberUtils.isNumber(money)){
        		gen.writeString(MoneyUtil.getDisplayRMB(money));
        	}else{
        		gen.writeString(money);
        	}
        }  
    }  